#pragma once

#include "GLFWApp.h"

#include <vector>
#include "GeometryManager.h"
#include "LightManager.h"

#include "vertex_formats.h"

#define _USE_MATH_DEFINES
#include <math.h>
#include "Model.h"
#include "ShadowManager.h"
#include "PastyCam.h"

class Shader;

class GameManager : public GLFWApp
{

private:
	bool startedGame;
	bool startedEditor;
	LightManager *lm;

	std::string selectedModelName;
	std::vector< Model > models;
	Model playerAvatar;
	glm::vec3 pickPos;
	float colorPickMapWidth;
	float colorPickMapLength;
	float colorPickMapPosY;

	// Editor
	float xAngle;
	float yAngle;
	float zAngle;

	bool canPlaceAnother;

	PastyCam myCamera;
	PastyCam lightCamera;
	float mouseSpeedX, mouseSpeedY;
	ShadowManager shadowManager;
	MouseInfo Mouse;
	
	glm::vec3 doColorPicking();
	void createSphere( std::vector<XYZ>& vertices, std::vector<XYZ>& normals );
	void loadModels();
	void updateCameraControl();
	void DrawWalls();
	void renderScene(bool isDepthRender);
	void renderScene2(bool isDepthPass);
	void renderMenuScreen();
	void drawCamera(float modelview[16], float camFrame[16]);


	void begin2d();
	void end2d();


protected:
	void render();
	void update();
	void init();

public:

	GameManager();
	virtual ~GameManager(){}
	
};